 <!-- 头部 -->
	{include file='public/header'}
<!-- 头部 --> 

<div class="content">
				<div class="tips_msg none"><span class="tips">保存成功</span><span class="close_tips"></span></div>
				<div class="edit_box">
					<div class="edit_title">{$meta_title|default=""}</div>
					<div class="edit_tab">
						<div class="tab_option on">基础</div>
						<div class="tab_option">高级</div>
					</div>
					<div class="edit_content">
					   <form class="group-form"  action="{:url('')}" method="post">
						<div class="edit_content_tab">
						<div class="input_title">名称<span>(模块名称)</span></div>
							<input type="text" name="title" class="input_box" value="{$info.title|default=""}"/>
						<div class="input_title">链接<span>(模块链接)</span></div>
						    <input type="text" id="user-weibo" class="input_box" name="url" value="{$info.url|default=""}">
					  	  <div class="upload_div">
								<div class="input_title">图片<span>(图片名称)</span></div>
								<div class="upload_btn_group">
									<div class="upload_btn">上传图片</div>
									<input type="file" class="upload_file" id="cover_id" />
								</div>
								<div class="upload_imgs">
									<input type="hidden" name="cover_id" value="{$info.cover_id|default=""}"	>
									<span class="upload_imgs_wrap cover_id">
									  {notempty name="info['cover_id']"}
							              <div class="upload-pre-item"> <img src="{$info.cover_id|get_cover_path}"/>
						                </div>{/notempty}
									
									</span>
									
								</div>
							</div>
					<script type="text/javascript">  
						 	var upload_url = "{:url('uploads/picture')}";	
  window.onload = function(){  
  
    // 选择图片  
    document.getElementById('cover_id').onchange = function(event){  
        var img = event.target.files[0];  
        // 判断是否图片  
        if(!img){  
            return ;  
        }  
        // 判断图片格式  
        if(!(img.type.indexOf('image')==0 && img.type && /\.(?:jpg|png|gif)$/.test(img.name)) ){  
            alert('图片只能是jpg,gif,png');  
            return ;  
        }  
        var reader = new FileReader();  
        reader.readAsDataURL(img);  
  
        reader.onload = function(e){ // reader onload start  
            // ajax 上传图片  
            $.post(upload_url, { img: e.target.result},function(ret){  
                if(ret){  
                   $("input[name='cover_id']").val(ret.id);
				       $('.upload_imgs_wrap').html(
				        		'<img src="' +ret.src + '"/>'
				       );  
                }else{  
                    alert('upload fail');  
                }  
            },'json');  
        } // reader onload end  
    }  
  
  }  
  </script>	
						 <div class="input_title">链接打开方式<span>（_blank或_self）</span></div>
						    <select name="target">
				           <option value="_blank"  {notempty name="info['target']"}{eq name="info.target" value="_blank"}selected{/eq}{/notempty}>新窗口</option>
				           <option value="_self"  {notempty name="info['target']"}{eq name="info.target" value="_self" }>selected{/eq}{/notempty}>当前窗口</option>
                           </select>
						    <div class="input_title">状态<span>(1-正常，0-禁用)</span></div>
							<input type="text" name="status" class="input_box" value="{$info.status|default="1"}"/>
					  	 </div>
				         <div class="edit_content_tab none">
						   <div class="input_title">排序<span>(越小越靠前)</span></div>
							<input type="text" name="sort" class="input_box" value="{$info.sort|default=""}"/>
						 </div>
						 <div class="btn_group">
						    <input type="hidden" name="id" value="{$info.id|default=""}">
							<div class="confirm_btn">确认</div>
							<div class="cancel_btn">返回</div>
						</div>
						</form> 
					</div>
				</div>
			</div>
		</div>
 <script src="__JS__/edit.js"></script>
<!-- 尾部 -->
	{include file='public/footer'}
    <!-- 尾部 --> 
